package edu.cug.water.crawler.job.utils;

import com.frameworkset.util.StringUtil;

public class DataConvertUtil {

    public static String stationCodeConvert(String stationCode) {

        if (StringUtil.isEmpty(stationCode)) return "null";

        stationCode = stationCode.trim();

        int t = stationCode.indexOf('.');
        if (t != -1) stationCode =  stationCode.substring(0, t);

        int len =stationCode.length();
        if (len == 8) return stationCode;
        else if (len > 8) return stationCode.substring(0, 8);
        else return String.format("%08d", Integer.valueOf(stationCode));
    }
}
